package com.csd.service.impl;

import com.csd.dao.SysCityDao;
import com.csd.pojo.SysCity;
import com.csd.service.CarCityService;
import com.csd.vo.Vcity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ Author :lihainan
 * @ ClassNmae :CarCityServiceImpl
 * @ Description :TODO
 * @ Date :2020/12/23
 * @ Version 1.0
 */
@Service
public class CarCityServiceImpl implements CarCityService {


    @Autowired
    private SysCityDao sysCityDao;

    @Override
    public List<SysCity> selectCitiesByPid(int pid) {
        List<SysCity> list = sysCityDao.findCitiesByPid(pid);
        return list;
    }

    @Override
    public List<SysCity> selectAllInfo() {
        List<SysCity> list = sysCityDao.findAll();
        return list;
    }

    @Override
    public Vcity selectCitys(Integer getid, Integer backid) {
        SysCity getCity = sysCityDao.selectByCity(getid);
        SysCity backCity = sysCityDao.selectByCity(backid);

        Vcity vcity = new Vcity();
        vcity.setGetCity(getCity);
        vcity.setBackCity(backCity);

        return vcity;
    }

}
